import { Method } from '../method'
import service from '../service'

export default {
  // 登录
  login(mobile: string, mobileCode: string) {
    return service({
      url: `/seal/rest/account/loginV2`,
      method: Method.POST,
      body: {
        mobile,
        mobileCode,
      },
    })
  },
  getInfo(notToLogin: boolean) {
    return service({
      url: `/seal/rest/account/getLoginAccountInfo`,
      method: Method.POST,
      body: {},
      notToLogin,
    })
  },
  logout() {
    return service({
      url: `/seal/rest/account/logout`,
      method: Method.POST,
      body: {},
    })
  },
  sendMobileCode(data: any) {
    return service({
      url: '/seal/rest/account/sendMobileCode',
      method: Method.POST,
      body: {
        name: data.username,
        mobile: data.phone,
        idCard: data.licenseNumber,
        signUpFlag: data.signUpFlag,
      },
    })
  },
  sendLoginCode(data: any) {
    return service({
      url: '/seal/rest/account/sendLoginCode',
      method: Method.POST,
      body: {
        mobile: data.phone,
      },
    })
  },
  simpleSendMobileCode() {
    return service({
      url: '/seal/rest/account/simpleSendMobileCode',
      method: Method.POST,
      body: {},
    })
  },
  signUp(data: any) {
    return service({
      url: '/seal/rest/account/signUp',
      method: Method.POST,
      body: {
        name: data.username,
        mobile: data.phone,
        idCard: data.licenseNumber,
        mobileCode: data.mobileCode,
      },
    })
  },
  modifyAccount(data: any) {
    return service({
      url: '/seal/rest/account/modifyAccount',
      method: Method.POST,
      body: data,
    })
  },
  // 检查是否有印章管理员授权
  checkIsAuthManager() {
    return service({
      url: '/seal/rest/apply/checkIsAuthManager',
      method: Method.POST,
      body: {},
    })
  },

  ignoreBindingHint() {
    return service({
      url: '/seal/rest/account/ignoreBindingHint',
      method: Method.POST,
      body: {},
    })
  },

  queryDingAccountByMobile(mobile: string) {
    return service({
      url: '/seal/rest/account/queryDingAccountByMobile',
      method: Method.POST,
      body: {
        mobile,
      },
    })
  },
  bindingDingAccount(dingUserId: string) {
    return service({
      url: '/seal/rest/account/bindingDingAccount',
      method: Method.POST,
      body: {
        dingUserId,
      },
    })
  },
  listMyDeliveryAddress() {
    // 获取收货地址列表
    return service({
      url: '/seal/rest/account/listMyDeliveryAddress',
      method: Method.POST,
      body: {},
    })
  },
  modifyDeliveryAddress(data: any) {
    // 修改
    return service({
      url: '/seal/rest/account/modifyDeliveryAddress',
      method: Method.POST,
      body: data,
    })
  },
  insertDeliveryAddress(data: any) {
    // 新增
    return service({
      url: '/seal/rest/account/insertDeliveryAddress',
      method: Method.POST,
      body: data,
    })
  },
  setAddressAsDefault(data: any) {
    // 设置默认
    return service({
      url: '/seal/rest/account/setAddressAsDefault',
      method: Method.POST,
      body: data,
    })
  },
  deleteDeliveryAddress(data: any) {
    // 删除
    return service({
      url: '/seal/rest/account/deleteDeliveryAddress',
      method: Method.POST,
      body: data,
    })
  },
  accountDataMasking(data: any) {
    // 获取不脱敏的用户信息
    return service({
      url: '/seal/rest/dataMasking/accountApply',
      method: Method.POST,
      body: data,
    })
  },
  payOrganizeDataMasking(data: any) {
    // 获取统付机构不脱敏数据
    return service({
      url: '/seal/rest/dataMasking/payOrganize',
      method: Method.POST,
      body: data,
    })
  },
  modifyMobileVerify(data: any) {
    return service({
      url: '/seal/rest/account/modifyMobileVerify',
      method: Method.POST,
      body: data,
    })
  },
  sendRebindingMsg(data: any) {
    return service({
      url: '/seal/rest/message/sendRebindingMsg',
      method: Method.POST,
      body: data,
    })
  },
  rebindTheMobile(data: any) {
    return service({
      url: '/seal/rest/account/rebindTheMobile',
      method: Method.POST,
      body: data,
    })
  },
  ignoreUploadApplyExampleHint(data: any) {
    return service({
      url: '/seal/rest/account/ignoreUploadApplyExampleHint',
      method: Method.POST,
      body: data,
    })
  },
}
